package com.shwread.android.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.widget.Button;

import com.shwread.android.qysw10000204.R;


/**
 * 引导弹窗
 * 
 * @author 刘宾
 * @date 2015年2月4日 下午1:54:50
 */
public class GuideDialog
        extends
        Dialog
        implements
        android.view.View.OnClickListener
{
	private Context context;
	private int     viewId;
	private Button  closeBtn;
	
	public GuideDialog(Context context, int viewId) {
		super(context, R.style.guide_dialog);
		this.context = context;
		this.viewId = viewId;
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setCancelable(false);
		View view = LayoutInflater.from(context).inflate(viewId, null);
		closeBtn = (Button) view.findViewById(R.id.help_firstin_close_btn);
		closeBtn.setOnClickListener(this);
		setContentView(view);
		
		getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	}
	
	@Override
	public void onBackPressed() {
		dismiss();
		super.onBackPressed();
	}
	
	@Override
	public void onClick(View v) {
		if (v == closeBtn) dismiss();
	}
	
}
